﻿package com.ease.model.type
{
	import com.ease.common.enums.TextualEnum;
	import com.ease.lang.Enum;
	import com.ease.lang.EnumConstants;
	import com.ease.model.type.DataType;
	import com.ease.model.type.DatabaseDataType;

	[Bindable]
	[RemoteClass(alias="com.ease.model.type.DatabaseDataType")]

	public class DatabaseDataType extends Enum
	{
		/* static init */
		{ initEnum(DatabaseDataType); }

		/* Constants */
		public static const CHAR:DatabaseDataType = new DatabaseDataType("CHAR", "CHAR", com.ease.model.type.DataType.STRING);
		public static const DATE:DatabaseDataType = new DatabaseDataType("DATE", "DATE", com.ease.model.type.DataType.DATE);
		public static const NUMBER:DatabaseDataType = new DatabaseDataType("NUMBER", "NUMBER", com.ease.model.type.DataType.LONG);
		public static const VARCHAR2:DatabaseDataType = new DatabaseDataType("VARCHAR2", "VARCHAR2", com.ease.model.type.DataType.STRING);
		public static const BLOB:DatabaseDataType = new DatabaseDataType("BLOB", "BLOB", com.ease.model.type.DataType.STRING);
		public static const CLOB:DatabaseDataType = new DatabaseDataType("CLOB", "CLOB", com.ease.model.type.DataType.STRING);
		public static const FLOAT:DatabaseDataType = new DatabaseDataType("FLOAT", "FLOAT", com.ease.model.type.DataType.FLOAT);
		public static const LONG:DatabaseDataType = new DatabaseDataType("LONG", "LONG", com.ease.model.type.DataType.STRING);
		public static const LONG_RAW:DatabaseDataType = new DatabaseDataType("LONG_RAW", "LONG RAW", com.ease.model.type.DataType.STRING);
		public static const RAW:DatabaseDataType = new DatabaseDataType("RAW", "RAW", com.ease.model.type.DataType.STRING);
		public static const TIMESTAMP6:DatabaseDataType = new DatabaseDataType("TIMESTAMP6", "TIMESTAMP(6)", com.ease.model.type.DataType.STRING);

		private var _text:String;
		private var _dataType:com.ease.model.type.DataType;

		/*public*/ function DatabaseDataType(name:String=null ,text:String=null ,dataType:com.ease.model.type.DataType=null) {
			super.name = name;
			this._text = text;
			this._dataType = dataType;
		}

		public function get text():String  { return this._text; }
		public function get dataType():com.ease.model.type.DataType  { return this._dataType; }

		/* constant query */
		public static function getEnumConstants():Array {
			return Enum.getEnumConstants(DatabaseDataType);
		}

		public static function get(constantName:String, caseSensitive:Boolean = false):DatabaseDataType {
			return DatabaseDataType(Enum.get(DatabaseDataType, constantName, caseSensitive));
		}
	}
}